home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 127 / PC Guia 127.iso / Software / Produtividade / OpenOffice.org 2.0.1 / openofficeorg2.cab / index8.html.xsl < prev    next >
Extensible Markup Language  |  2004-11-27  |  5KB  |  191 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- =================================================
  3.  
  4. This template is a skeleton for single level TOC pages 
  5. Do not overwrite this ! copy it and complete the missing
  6. code.
  7.  
  8. I use the @ character whereever there is a missing code, so 
  9. you can use a simple find to navigate and find the
  10. places...
  11.  
  12. ====================================================== -->
  13. <!DOCTYPE xsl:stylesheet [
  14.  
  15. <!ENTITY x1 "0">
  16. <!ENTITY x2 "250">
  17. <!ENTITY x3 "500">
  18.  
  19. <!ENTITY y1 "0">
  20. <!ENTITY y2 "150">
  21. <!ENTITY y3 "0">
  22.  
  23.  
  24. ]>
  25. <xsl:stylesheet version="1.0" 
  26.    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  27.     xmlns="http://www.w3.org/1999/xhtml">
  28.     
  29.     <xsl:output method               = "html"
  30.                 media-type           = "text/html"
  31.                 indent               = "yes"
  32.                 doctype-public       = "-//W3C//DTD HTML 4.0 Transitional//EN"
  33.                 omit-xml-declaration = "yes"
  34.                 standalone           = "yes" />
  35.   
  36.     <xsl:include href="../layout.xsl"/>
  37.      
  38.      <!-- =============================
  39.                    HTML BODY
  40.      ================================== -->
  41.      
  42.      <xsl:template name="body">
  43.          <body>
  44.        <xsl:call-template name="title"/>
  45.          <xsl:call-template name="toc"/>
  46.          </body>
  47.      </xsl:template>
  48.      
  49.      
  50.      <xsl:template name="toc">
  51.         <!--
  52.              @ pre toc html here
  53.         -->
  54.         
  55.         <xsl:apply-templates select="/session/content/document"/>
  56.         
  57.         <!--
  58.              @ post toc html here
  59.         -->
  60.         
  61.      </xsl:template>
  62.      
  63.     
  64.      
  65.     <!-- also when using groups, in the end it comes 
  66.     to this template, which is called for each document -->
  67.     <xsl:template match="document">
  68.       
  69.       <xsl:variable name="i"    select="position() - 1"/>
  70.     
  71.       <xsl:variable name="x1">
  72.         <xsl:call-template name="x"/>
  73.       </xsl:variable>
  74.       
  75.         <xsl:variable name="x" select="number($x1) + 50 "/>
  76.  
  77.       <xsl:variable name="y1">
  78.            <xsl:call-template name="y"/>
  79.       </xsl:variable>
  80.  
  81.         <xsl:variable name="y" select="(floor($i div 3)) * 300 + number($y1) + 80 "/>
  82.     
  83.       <div style="position:absolute; padding:15px; left:{$x}px; top:{$y}px; width:170px; height:220px; z-index:1" class="tcolor">
  84.           <div align="center">
  85.  
  86.             <xsl:apply-templates select="@icon"/>
  87.             <p>
  88.               <xsl:apply-templates select="@title"/>
  89.             <xsl:apply-templates select="@description"/>
  90.             <xsl:apply-templates select="@author"/>
  91.             <xsl:apply-templates select="@create-date"/>
  92.             <xsl:apply-templates select="@update-date"/>
  93.             <xsl:apply-templates select="@filename"/>
  94.             <xsl:apply-templates select="@format"/>
  95.             <xsl:apply-templates select="@pages"/>
  96.             <xsl:apply-templates select="@size"/>
  97.             </p>
  98.           </div>
  99.       </div>
  100.     </xsl:template>
  101.         
  102.     <xsl:template name="x">
  103.         <xsl:variable name="i" select="position()"/>
  104.         <xsl:choose>
  105.             <xsl:when test="$i = 2">
  106.                 &x2;
  107.            </xsl:when>
  108.             <xsl:when test="$i = 3">
  109.                 &x3;
  110.            </xsl:when>
  111.             <xsl:otherwise>
  112.                 <xsl:choose>
  113.                     <xsl:when test="($i mod 3) = 1">
  114.                         &x1;
  115.                     </xsl:when>
  116.                     <xsl:when test="($i mod 3) = 2">
  117.                         &x3;
  118.                     </xsl:when>
  119.                     <xsl:when test="($i mod 3) = 0">
  120.                         &x2;
  121.                     </xsl:when>
  122.                 </xsl:choose>
  123.             </xsl:otherwise>
  124.         </xsl:choose>
  125.     </xsl:template>
  126.  
  127.     <xsl:template name="y">
  128.         <xsl:variable name="i" select="position()"/>
  129.         <xsl:choose>
  130.             <xsl:when test="$i = 2">
  131.                 &y2;
  132.            </xsl:when>
  133.             <xsl:when test="$i = 3">
  134.                 &y3;
  135.            </xsl:when>
  136.             <xsl:otherwise>
  137.                 <xsl:choose>
  138.                     <xsl:when test="($i mod 3) = 1">
  139.                         &y1;
  140.                     </xsl:when>
  141.                     <xsl:when test="($i mod 3) = 2">
  142.                         &y3;
  143.                     </xsl:when>
  144.                     <xsl:when test="($i mod 3) = 0">
  145.                         &y2;
  146.                     </xsl:when>
  147.                 </xsl:choose>
  148.             </xsl:otherwise>
  149.         </xsl:choose>
  150.     </xsl:template>
  151.     
  152.              
  153.      <xsl:template name="document-group">
  154.          <xsl:param name="group"/>
  155.          
  156.          <!-- @ pre group code here -->
  157.          
  158.          <!-- - - -->
  159.  
  160.              <xsl:variable name="count" select="(position() - 1) * $group + 1"/>
  161.              
  162.              <xsl:for-each select="/session/content/document[$count <= position() and position() < ($count + $group)]">
  163.              
  164.                 <xsl:apply-templates select="."/>
  165.                    
  166.              </xsl:for-each>
  167.          
  168.          <!-- @ post group code here -->
  169.          
  170.          <!-- - - -->
  171.          
  172.      </xsl:template>
  173.  
  174.           
  175.      <xsl:template name="title">
  176.         <!--
  177.           @ Pre title html code here
  178.         -->
  179.        <div style="position:absolute; left:280px; top:8px; width:220px; z-index:2; padding:10px" class="ccolor">
  180.           <div align="center" class="toctitle">
  181.               <xsl:value-of select="/session/general-info/@title"/>
  182.                
  183.         <!--
  184.           @ Post title html code here
  185.         -->
  186.             </div>
  187.         </div>
  188.      </xsl:template>
  189.          
  190. </xsl:stylesheet>
  191.